<?php

use yii\db\Migration;

/**
 * Class m180313_015750_insert_admin_menu
 */
class m180313_015750_insert_admin_menu extends Migration
{
    // Use up()/down() to run migration code without a transaction.
    public function up()
    {
        $this->batchInsert('{{%admin_menu}}',
            ['id', 'name', 'parent', 'route', 'order'],
            [
                [1, '控制台', null, null, 1],

                [2, '系统维护', null, null, 2],



                [3, '优惠券管理', 1, null, 1],
                [4, '优惠券分类列表', 3, '/coupon-category/index', 1],
                [5, '优惠券列表', 3, '/coupon/index', 1],
                [6, '优惠券领取列表', 3, '/user-coupon/index', 2],

                [7, '活动', 1, '/activity/index', 2],
                [8, '活动列表', 7, '/activity/index', 1],

                [9, '商品', 1, null, 3],
                [10, '商品列表', 9, '/product/index', 1],

                [11, '拼团结果表',1, null, 4],
                [12, '拼团成功', 11, '/groupbuy/index', 1],
                [13, '拼团中', 11, '/groupbuy/group', 1],

                [14, '权限管理', 2, null, 1],
                [15, '用户列表', 14,'/admin/user' , 1],
                [16, '分配权限', 14,'/admin/assignment' , 2],
                [17, '角色列表', 14,'/admin/role' , 3],
                [18, '权限列表', 14,'/admin/permission' , 4],
                [19, '菜单列表', 14,'/admin/menu' , 5],

                [20, '客户列表', 2, null, 6],
                [21, '客户列表', 20,'/user/index' , 6],

            ]
        );

        return true;
    }

    public function down()
    {

        $this->truncateTable("{{%admin_menu}}");
        return true;
    }
}
